// 表单验证原子
const username = [{
  validator (val) {
    return /^[-_a-zA-Z0-9]{4,16}$/.test(val)
  },
  message: '用户名错误'
}]

const password = [{
  validator (val) {
    return /^[-_a-zA-Z0-9]{4,16}$/.test(val)
  },
  message: '密码错误'
}]

const name = [{
  validator (val) {
    return /^[_a-zA-Z0-9\u2E80-\uFE4F]{1,10}$/.test(val)
  },
  message: '姓名格式错误'
}]

const address = [{
  validator (val) {
    return /^[_a-zA-Z0-9\u2E80-\uFE4F]{1,30}$/.test(val)
  },
  message: '地址格式错误'
}]

export default {
  username,
  password,
  name,
  address
}
